package com.gougou.front.web.controller;

import com.gougou.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/redis")
public class TestRedisController {
    @Autowired
    private RedisService redisService;

    /***********************
     *
     * 从redis里取值：
     *
     * @param key
     * @return
     * *********************
     */
    @RequestMapping("/get/{key}")
    public String getValue(@PathVariable String key){
        return redisService.get(key);
    }

    /********************
     *
     * 设置值到redis里 key=value
     *
     * @param key
     * @param value
     * @return
     * *******************
     */

    @RequestMapping("/set")
    public String setValue(String key,String value){
        return redisService.set(key,value);
    }




}
